package org;

import java.io.File;
import java.util.List;

import org.dom4j.Attribute;
import org.dom4j.Document;
import org.dom4j.DocumentException;
import org.dom4j.Element;
import org.dom4j.io.SAXReader;
import org.red.shop.propinfo.PorpInfoBean;

public class XmlEditShow {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		XmlEditShow xes = new XmlEditShow();
		try {
			xes.showinfo();
		} catch (DocumentException e) {
			
			e.printStackTrace();
		}

	}

	/**
	
	 */
	private void showinfo() throws DocumentException {
		SAXReader reader = new SAXReader();
		Document document = reader
				.read(new File("D:/job.doc/propeditinfo.xml"));
		Element rootElm = document.getRootElement();
		List propLst = rootElm.elements();
		System.out.println(rootElm.getName());
		PorpInfoBean pib = new PorpInfoBean();
		pib.toString();
		for (int i = 0; i < propLst.size(); i++) {
			Element elem = (Element) propLst.get(i);
			System.out.println(elem.getName());
			Attribute prop_id_att = elem.attribute("id");// 
			Attribute prop_name_att = elem.attribute("name");// 
			Attribute prop_itemType_att = elem.attribute("itemType");// 
			
			Attribute prop_propType_att = elem.attribute("propType");// 
			Attribute prop_canHide_att = elem.attribute("canHide");// 
			prop_itemType_att.asXML();
			prop_propType_att.asXML();
			prop_canHide_att.asXML();
			
			System.out.println(prop_id_att.getValue() + " "
					+ prop_name_att.getValue());
		}
	}

}
